import pandas as pd
from pyecharts import options as opts
from pyecharts.charts import WordCloud
import jieba
df=pd.read_excel('某店铺2023年1—9月份评价数据_预处理.xlsx')
content=''
for text in df['评价']:
    content=content+text
words=jieba.lcut(content)
word_counts={}
for word in words:
    if len(word)>1:
        word_counts[word]=word_counts.get(word,0)+1
wordCloud=WordCloud(init_opts=opts.InitOpts(page_title='词云图'))
wordCloud.add(series_name='',data_pair=word_counts.items(),
              word_size_range=[20,80])
wordCloud.set_global_opts(
    title_opts=opts.TitleOpts(
        title='某店铺2023年1—9月份评价数据_预处理词云图',pos_left='center'),
    legend_opts=opts.LegendOpts(is_show=False)
)
wordCloud.render('wordCloud.html')
